import React, { Component } from 'react';
import RenderTableAndDownload from './util';

class ExportTableToExcel extends Component {
  constructor(props) {
    super(props)
    this.myRef = React.createRef();
  }

  exportTable = () => {
    const table = this.myRef.current.innerHTML;
    RenderTableAndDownload(table);
  }
  render() {
    const { children } = this.props;
    return (
      <div className="exportTableToExcel" ref={this.myRef}>
        { children }
      </div>
    );
  }
}

export default ExportTableToExcel;
